﻿using DailyPoetryX.Services;
using DailyPoetryX.Services.Implementations;
using GalaSoft.MvvmLight.Ioc;

namespace DailyPoetryX.ViewModels {
    public class ViewModelLocator {
        public MenuPageViewModel MenuPageViewModel =>
            SimpleIoc.Default.GetInstance<MenuPageViewModel>();

        public InitializationPageViewModel InitializationPageViewModel =>
            SimpleIoc.Default.GetInstance<InitializationPageViewModel>();

        public TodayPageViewModel TodayPageViewModel =>
            SimpleIoc.Default.GetInstance<TodayPageViewModel>();

        public QueryPageViewModel QueryPageViewModel =>
            SimpleIoc.Default.GetInstance<QueryPageViewModel>();

        public ResultPageViewModel ResultPageViewModel =>
            SimpleIoc.Default.GetInstance<ResultPageViewModel>();

        public DetailPageViewModel DetailPageViewModel =>
            SimpleIoc.Default.GetInstance<DetailPageViewModel>();

        public FavoritePageViewModel FavoritePageViewModel =>
            SimpleIoc.Default.GetInstance<FavoritePageViewModel>();

        public AboutViewModel AboutViewModel =>
            SimpleIoc.Default.GetInstance<AboutViewModel>();

        public SyncPageViewModel SyncPageViewModel =>
            SimpleIoc.Default.GetInstance<SyncPageViewModel>();

        public MainPageViewModel MainPageViewModel =>
            SimpleIoc.Default.GetInstance<MainPageViewModel>();

        public ViewModelLocator() {
            SimpleIoc.Default.Register<IPoetryStorage, PoetryStorage>();
            SimpleIoc.Default
                .Register<IRootPageActivationService,
                    CachedRootPageActivationService>();
            SimpleIoc.Default
                .Register<IContentPageActivationService,
                    CachedContentPageActivationService>();
            SimpleIoc.Default
                .Register<IRootNavigationService, RootNavigationService>();
            SimpleIoc.Default
                .Register<IContentNavigationService, ContentNavigationService
                >();
            SimpleIoc.Default.Register<MenuPageViewModel>();
            SimpleIoc.Default.Register<InitializationPageViewModel>();

            SimpleIoc.Default.Register<ITodayImageStorage, TodayImageStorage>();
            SimpleIoc.Default.Register<IAlertService, AlertService>();
            SimpleIoc.Default.Register<ITodayImageService, BingImageService>();
            SimpleIoc.Default
                .Register<ITodayPoetryService, JinrishiciService>();
            SimpleIoc.Default.Register<TodayPageViewModel>();

            SimpleIoc.Default.Register<QueryPageViewModel>();
            SimpleIoc.Default.Register<ResultPageViewModel>();

            SimpleIoc.Default.Register<IFavoriteStorage, FavoriteStorage>();
            SimpleIoc.Default.Register<DetailPageViewModel>();

            SimpleIoc.Default.Register<FavoritePageViewModel>();
            SimpleIoc.Default.Register<AboutViewModel>();

            SimpleIoc.Default.Register<OneDriveFavoriteStorage>();
            SimpleIoc.Default.Register<SyncPageViewModel>();

            SimpleIoc.Default.Register<MainPageViewModel>();
        }
    }
}